package com.gwkj.zxjl_user.Utils;

import android.graphics.Bitmap;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

/**
 * 网络图 加载中 加载失败
 * Created by FuJiahui on 2016/7/12.
 */
public class ImgOptUtils {

    public static DisplayImageOptions getOpt(int errorImg) {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(false)
                .cacheOnDisk(true)
                .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
                .bitmapConfig(Bitmap.Config.ARGB_8888)
                .showImageForEmptyUri(errorImg)
                .showImageOnFail(errorImg)
                .build();
        return options;
    }

    public static DisplayImageOptions getOpt(int loadingImg, int errorImg) {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(false)
                .cacheOnDisk(true)
                .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
                .bitmapConfig(Bitmap.Config.ARGB_8888)
                .showImageOnLoading(loadingImg)
                .showImageForEmptyUri(errorImg)
                .showImageOnFail(errorImg)
                .build();
        return options;
    }
}
